import React, { Component } from 'react'
import ListCard from '../ListCard/ListCard'
import { getAllUserListAxios } from '../../api/api'

export default class UserList extends Component {
   state = {
      users: []
   }
   componentDidMount() {
      getAllUserListAxios(this.props.type).then(res => {
         this.setState({ users: res.data })
      })
   }
   render() {
      return (
         <div className='dashen-list'>
            {
               this.state.users.map((item) => {
                  return <ListCard key={item._id} path='/1' userInfo={item} />
               })
            }
         </div>
      )
   }
}
